<template>
	<view>
		<view class="content"
			style=" border-radius: 50%; width: 200px; height: 200px; overflow: hidden;margin-left: 20%;">
			<image :src=Image style="width: 100%; height: 100%;"></image>
		</view>
		<view class="" style="margin: 30px;">
			<button @click="updateImage()">选择图片显示</button>
			<button @click="lookphoto()">预览图片</button>
			<button @click="getphoto()">获取图片信息</button>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				Image: "/static/city1.png"
			}
		},
		methods: {
			updateImage() {
				uni.chooseImage({
					success: (res) => {
						console.log("选择的图片临时路径：", res.tempFilePaths[0]);
						this.Image = res.tempFilePaths[0];
					}
				})

			},
			lookphoto(){
				uni.previewImage({
				urls:[this.Image]
				})
			},
			getphoto(){
			  uni.getImageInfo({
			    src: this.Image,
			    success:(image)=>{
			      console.log("图片信息为：宽度"+image.width+",高度"+image.height);
			    }
			  })
			}
			
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
</style>